package com.wyu.servlet;

import com.wyu.dao.CGDao;
import com.wyu.dao.CGDaoImpl;
import com.wyu.service.CGService;
import com.wyu.service.CGServiceImpl;
import com.wyu.service.YGService;
import com.wyu.service.YGServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/DeleteCgServlet")
public class DeleteCgServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String wpbh = request.getParameter("wpbh");
        System.out.println("要登记的物品编号:"+wpbh);
        CGDao dao = new CGDaoImpl();
        int i = dao.deletebyWpbh(wpbh);
        System.out.println("登记"+i+"个需求");
        response.sendRedirect("cgxx.jsp");
        request.getSession().setAttribute("Deletemessage","登记");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
